<!--
	作者：zhushoulong1016@163.com
	时间：2014-11-27
	描述：登录页
-->
<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>搜班</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<script src="js/mui.min.js"></script>
		<script src="js/update.js" type="text/javascript" charset="utf-8"></script>
        <script src="js/jquery-1.9.1.min.js"></script>
        <script type="text/javascript" src="js/index.js"></script>
		<script>
/**
 * 用户登录
 */
function login(){
	var w=plus.nativeUI.showWaiting('登录中,请耐心等待');
	setTimeout( function(){
		w.close();   
		mui.openWindow({
           url: 'index.html', 
           id:'index',
           styles:{
               top:'0',//新页面顶部位置
               bottom:'0'//新页面底部位置
           }
        });
	},1000)
	  
} 
     
     mui.plusReady(function() {
        	
        	document.getElementById('btn_login').addEventListener('tap', function() {
            	var flag =  strempty();
            	if (flag) {
            		mui.ajax({ //ajax请求
					 url: getServerIp + 'AppUser/login',
					 type: 'post',
					data: {    
                      phone:$("#login_username").val(),
                      password:$("#login_password").val()
					}, //传参
					success: function(data, textStatus, jqXHR) {
    					var code = data.code;
    					if(code ==1){
    						plus.storage.setItem('userinfo',data.user.phone + "@_@_@" + data.user.password );
    						plus.storage.setItem('user_id',data.user.id );
    						plus.storage.setItem('username',data.user.username );
    						plus.storage.setItem('phone',data.user.phone );
    						plus.storage.setItem('image',data.user.image );
//  						alert(userinfo);
    						login();
    					}else{
    						alert(data.msg);
    					}
									
					 }
				    })
            	} 
                 
          });
        	
            document.getElementById('rempasswor').addEventListener('tap', function() {
                mui.openWindow({
                    url: 'plus/Data/passwordRetrieve.html', 
                    id:'passwordRetrieve'
                });
            }); 
            
            document.getElementById('register').addEventListener('tap', function() {
                mui.openWindow({
                    url: 'registered.html', 
                    id:'registered'
                });
            }); 
        });
		</script>
		
		<link rel="stylesheet" href="css/mui.min.css">
		<link rel="stylesheet" href="css/palm.css">
		<style>
			html,
			body {
				background-color: #efeff4;
			}
			.mui-bar .mui-pull-left .mui-icon {
				padding-right: 5px;
				font-size: 28px;
			}
			.mui-bar .mui-btn {
				font-weight: normal;
				font-size: 17px;
			}
			.mui-bar .mui-btn-link {
				top: 1px;
			}
			.user_login {
				margin: 0;
				height: 10%;
				min-height: 40px;
			}
		</style>
	</head>

	<body>

		<header class="mui-bar mui-bar-nav">
			<h1 class="mui-title">登录</h1>
		</header>
        <div style="text-align: center;">
        	<img src="icon.png" style="width: 40%;position: relative;margin-top: 30%;"/>
        </div>
        <form class='queryform' id='loginform'>
        <div style="border: 1px solid #83E5AB;margin: 0 10%;padding: 10px;margin-bottom: 40px;background: #fff;">
        	<div class="user_login" style="border-bottom: 1px solid #83E5AB;">
        		<input id="login_username" type="tel" placeholder="手机号"/>
        	</div>
        	<div class="user_login">
			    <input id="login_password" type="password" placeholder="密码"/>
        	</div>
        </div>
        
        	<div id="btn_login" class='button'>登&nbsp&nbsp&nbsp&nbsp录</div>
        	<div style="margin: 0 10%;padding: 10px;">
        	    <a id="rempasswor" style="float: left;color: #A9A9A9;">忘记密码？</a>
        	    <a id="register" style="float: right;color: #A9A9A9;">点击注册新页面>></a>
        	</div>
	
        </form>
        
    </body>

</html>
